include(FindPackageHandleStandardArgs)

if(CLOG_LIBRARIES AND CLOG_INCLUDE_DIRS)
    # in cache already
    set(LibCLOG_FOUND TRUE)

    message(STATUS  "find include ${CLOG_INCLUDE_DIRS} lib ${CLOG_LIBRARIES} ===")
else()
    find_path(CLOG_INCLUDE_DIR
        NAMES
        clog/log.h
        PATHS
        /usr/include
        /usr/local/include
        /opt/local/include
        ${CMAKE_INCLUDE_PATH}
        ${CMAKE_INSTALL_PREFIX}/include
    )

    find_library(CLOG_LIBRARY
        NAMES
        clog
        libclog
        PATHS
        /usr/lib
        /usr/lib64
        /usr/local/lib
        /usr/local/lib64
        /opt/local/lib
        ${CMAKE_LIBRARY_PATH}
        ${CMAKE_INSTALL_PREFIX}/lib
    )


    set(CLOG_INCLUDE_DIRS ${CLOG_INCLUDE_DIR})
    set(CLOG_LIBRARIES ${CLOG_LIBRARY})
    mark_as_advanced(CLOG_INCLUDE_DIRS CLOG_LIBRARIES)

    # handle the QUIETLY and REQUIRED arguments and set CLOG_FOUND to TRUE
    # if all listed variables are TRUE
    find_package_handle_standard_args(LibCLOG FOUND_VAR LibCLOG_FOUND
        REQUIRED_VARS CLOG_LIBRARY CLOG_INCLUDE_DIR)
endif()
